V2EX  ›  英汉词典

Else If

Definition / 释义

(编程)“否则如果”。用于条件分支中:当前面的 if 条件不成立时,再检查另一个条件,从而在多种情况之间依次判断并选择执行路径。(在不同语言里也常写作 else-ifelseif,或缩写为 elif。)

Pronunciation (IPA) / 发音(IPA)

/ˌels ˈɪf/

Examples / 例句

If it’s raining, stay home; else if it’s cloudy, take an umbrella.
如果在下雨,就待在家;否则如果是阴天,就带把伞。

The program checks the input: if it’s empty, it shows an error; else if it’s too long, it trims it; otherwise, it saves it.
程序会检查输入:如果为空就报错;否则如果太长就截断;否则就保存。

Etymology / 词源

else(“否则;不然”)+ if(“如果”)组合而成,用来表达“在前一条件不成立的情况下,再进行下一条件判断”。其中 else 源自古英语 elles(“否则”),if 源自古英语 gif(“如果”)。

Related Words / 相关词汇

Notable Works / 文学与作品

  • The C Programming Language(Kernighan & Ritchie)
  • C Programming: A Modern Approach(K. N. King)
  • Java: The Complete Reference(Herbert Schildt)
  • Python Crash Course(Eric Matthes)
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1715 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 01:27 · PVG 09:27 · LAX 17:27 · JFK 20:27
♥ Do have faith in what you're doing.